<?php
    class Admin_Form_ValidateUser
    {
        public function validateUserName($user_name){
            $validate = new Zend_Validate_StringLength(1, 25);
            if($validate->isValid($user_name)){
                
                $validate = new Zend_Validate_Alpha(true);
                
                if($validate->isValid($user_name)){
                    return true;
                }
                else{
                    return false;
                }
            }
            else{
                return false;
            }
        }
        public function validateEmail($email){
            $validator = new Zend_Validate_EmailAddress();
            if ($validator->isValid($email)) {
                return true;
            }
            else{
                return false;
            }
        }
        public function validatePassword($pass){
            $validator = new Zend_Validate_StringLength(8, 25);
            if ($validator->isValid($pass)) {
                return true;
            }
            else{
                return false;
            }
        }
        public function validatePhone($phone){
            $validator = new Zend_Validate_StringLength(1, 25);         
            if ($validator->isValid($phone)) {
                $pattern = '#^[0]{1}[0-9]{9,10}$#';       
                if(preg_match($pattern,$phone)!=1){
                    return false;          
               }
               else{
                    return true;
               }               
            }
            else{
                return false;
            }
        }
          public function validateNotEmpty($keyword){
            $validate = new Zend_Validate_NotEmpty();
            if($validate->isValid($keyword)){
                return true;
            }
            else{
                return false;
            }
        }
        public function validateSearch($keyword){
            $validate = new Zend_Validate_NotEmpty();
            if($validate->isValid($keyword)){
                return true;
            }
            else{
                return false;
            }
        }
    }
